void httpHead(clientRequestTask *t)
{
    sprintf(t->path, "%s%s", t->xp->path, t->uri);
    if (t->path[strlen(t->path) - 1] == '/')
        strcat(t->path, "index.html");

    struct stat st;
    if (stat(t->path, &st) == -1) {
        httpStatus(t, 404, "Not Found");
    }
    else {
        if ((st.st_mode & S_IFMT) == S_IFREG) {
            char line[64];
            char *ext = strrchr(t->path, '.'); /* extension */
            char *ct = getMimesConfig(ext ? ext + 1: "html");
            httpStatus(t, 200, "OK");
            httpHeader(t, "Content-Type", ct ? ct : "text/html");
            sprintf(line, "Content-Length: %d\r\n", st.st_size);
            httpBody(t, line);
        }
        else {
            httpStatus(t, 200, "OK");
            httpHeader(t, "Content-Length", "-1");
        }
    }

    httpHeader(t, "Connection", "close");
    httpHeader(t, "Sever", "xsync");
    httpBody(t, "\r\n");
}
